package fr.afcepf.atod.gestionVP.bean;

import java.util.ArrayList;
import java.util.List;

import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
import javax.servlet.ServletContext;

import org.springframework.stereotype.Component;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import fr.afcepf.atod.gestionVP.data.Employe;
import fr.afcepf.atod.gestionVP.data.Salaire;
import fr.afcepf.atod.gestionVP.services.IServiceSalaire;
import fr.afcepf.atod.gestionVP.services.IServiceVente;
import fr.afcepf.atod.gestionVP.services.ServiceSalaire;


@Component("gestionPaieBean")
@SessionScoped
public class GestionPaieBean {

	
	private IServiceSalaire salaireService = null;
//	private ISer
	private Salaire salaire;
	private Employe employe;
	private List<Employe> listEmploye = new ArrayList<Employe>();
	private List<Employe> resulEmpl= new ArrayList<Employe>();
	
	
	public List<Employe> getResulEmpl() {
		return resulEmpl;
	}
	public void setResulEmpl(List<Employe> resulEmpl) {
		this.resulEmpl = resulEmpl;
	}
	public List<Employe> getListEmploye() {
		return listEmploye;
	}
	public void setListEmploye(List<Employe> listEmploye) {
		this.listEmploye = listEmploye;
	}
	public Salaire getSalaire() {
		return salaire;
	}
	public void setSalaire(Salaire salaire) {
		this.salaire = salaire;
	}
	public Employe getEmploye() {
		return employe;
	}
	public void setEmploye(Employe employe) {
		this.employe = employe;
	}
	
	public List<Employe> recupListEmploye(){		
		resulEmpl = new ArrayList<Employe>();
//		listEmploye=salaireService.getToutSalaire(arg0);
		for (Employe emp : listEmploye) {
			this.resulEmpl.add(emp);
		}
		return resulEmpl;
		
		
		
	}
	public GestionPaieBean() {
//		try {
//			ServletContext servletContext = (ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext();
//			WebApplicationContext ctx =	WebApplicationContextUtils.getWebApplicationContext(servletContext);
//			//System.out.println(ctx);
//			this.salaireService = (IServiceSalaire) ctx.getBean(IServiceSalaire.class);
//		} catch (Exception e) {
//			e.printStackTrace();
//		}
	}
	
}
